normal gg
"match below code
"    #define _VERSION_ID_    "NISSAN_DFL_DCM_2.5.14_20101009_BASELINE"
"    #define _VERSION_ID_    "NISSAN_INFINITI_DCM_02.07R_20111025"
let pattern='_VERSION_ID_.*' . expand(dcm_type) . '_.*"$'

"In infiniti, there are two place should be changed 
" #define _VERSION_ID_    "NISSAN_INFINITI_DCM_02.07R_20111025"
" #define _VERSION_ID_    "NISSAN_INFINITI_DCM_02.07R_20111025(NO_WD)"
"let ln=search(pattern,'p')
while search(pattern, "W") > 0
"match below code,the verison id in Infiniti is different with DFL&NCIC&L42L
"    2.5.14_20101009_BASELINE
"    02.07R_20111025
"
    exe 's/\d\+\..*\d/\=version_id/g'
    "move to next line, other wise it would re-search the curren line cause do
    "substitude action
    normal j
endwhile


normal gg
"for L42L, it use NISSAN_DCM_NCIC as define macro to set sgold version section
if expand(dcm_type)=='L42L'
    let dcm_type='NCIC'
endif
let pattern='.*if.*NISSAN_DCM_' . expand(dcm_type) . '.*)$'
call search(pattern, 'W')
call search("SGOLD_VER_HIGH", 'W')
exe 's/0x\x\+/\=sgold_ver_high/g'
call search("SGOLD_VER_LOW", 'W')
exe 's/0x\x\+/\=sgold_ver_low/g'
exe ":wq"
